package com.anlogic.sdk.ui.tests.uc1.workspacemgr;

import static org.junit.Assert.*;

import java.io.File;

import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.anlogic.sdk.ui.tests.utils.ProjectAttributeUtils;
import com.anlogic.sdk.ui.tests.utils.WorkspaceUtils;

public class UC1_TC001_Test {
	
	private static SWTWorkbenchBot bot;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {

		bot = new SWTWorkbenchBot();
		SWTBotPreferences.TIMEOUT = 10000;
		SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"), 90 * 1000);
	//	SWTBotPreferences.PLAYBACK_DELAY = 10;
		
	}

	@Before
	public void setUp() throws Exception {
		WorkspaceUtils.resetworkbench(bot);
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		
	}


	@After
	public void tearDown() throws Exception {
		
		WorkspaceUtils.cleanWorkspace();
	}

	@Test
	public void testValidWorkspace() throws Exception{
		String workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
		System.out.println("workspace:"+workspace);
		File ws = new File(workspace);
	    assertTrue(ws.exists() && ws.canRead() && ws.canWrite());
		
	}
	
	@Test
	public void TargetProcesser_FloatingpointRVF_Test() throws InterruptedException 
	{
		ProjectAttributeUtils.riscvTestcomboBox(bot, "Target Processor", 2, "Single precision extension (RVF)", "-march=rv32imafc");
	}
	

}
